package com.axend.aerosense.base;

import android.content.Context;

import androidx.annotation.Nullable;

import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.Logger;
import com.axend.aerosense.base.app.BaseApplication;
import com.axend.aerosense.base.impl.IModuleInit;
import com.axend.aerosense.base.utils.LogUtils;



/**
 * @author chenhongwei
 */
public class BaseModuleInit implements IModuleInit {

    private static Context myAppContext;

    @Override
    public boolean onInitAhead(BaseApplication application) {
        myAppContext = application;
        // 初始化日志
        Logger.addLogAdapter(new AndroidLogAdapter()
        {
            @Override
            public boolean isLoggable(int priority, @Nullable String tag)
            {
                return application.issDebug();
            }
        });
        LogUtils.d(this, "BaseModuleInit 模块初始化完成！");
        return false;
    }

    @Override
    public boolean onInitLow(BaseApplication application) {
        return false;
    }

    public static Context getAppContext() {
        return myAppContext;
    }
}
